<template>
  <div>
    <h1>小头爸爸</h1>
    <da-tou></da-tou>
    <button @click="giveMoney">小头给铁头money</button>
  </div>
</template>

<script>
import DaTou from "./DaTou.vue";
/* 
下载pubsub库 npm install pubsub-js
哪里使用pubsub库进行值的传递，就在哪里引入pubsub库

订阅消息
PubSub.subscribe('事件名'，(msg,index)=>{
    msg：需要写上，不用操作，不用写
})
发布消息
PubSub.publish('事件名',index)
*/
import PubSub from "pubsub-js";
export default {
  name: "",
  props: [""],
  data() {
    return {};
  },

  components: {
    DaTou,
  },

  beforeMount() {},

  mounted() {},

  methods: {
    giveMoney() {
      PubSub.publish("xiaotougive", "50元");
    },
  },

  watch: {},
};
</script>
<style lang='' scoped>
</style>